package com.ruoyi.psi.purchase.apply.mapper;



import com.ruoyi.psi.purchase.apply.domain.PurchaseApply;
import com.ruoyi.psi.purchase.apply.domain.PurchaseApplyList;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 采购申请单
 * 数据层
 * @author Drj 2021/6/28
 */
public interface PurchaseApplyMapper {
    /**
     * 采购申请单查询
     * @param purchaseApply
     * @return
     */
    public List<PurchaseApply> selectPurchaseApplyList(PurchaseApply purchaseApply);

    /**
     * 按编号查询
     * @param purchaseApplyId 采购申请单编号
     * @return
     */
    public PurchaseApply selectPurchaseApplyById(String purchaseApplyId);

    /**
     * 通过销售订单查找采购计划
     * @return
     */
    List<PurchaseApply> selectPurchaseApplyBySaleOrderId(String saleOrderId);

    /**
     * 获取最新的一条采购申请订单编号
     * @return
     */
    public String getPurchaseApplyId();

    /**
     * 采购申请单新增
     * @param purchaseApply
     * @return
     */
    public int insertPurchaseApply(PurchaseApply purchaseApply);

    /**
     * 采购申请单更新
     * @param purchaseApply
     * @return
     */
    public int updatePurchaseApply(PurchaseApply purchaseApply);

    /**
     * 更新采购申请单删除标志位
     * @param purchaseApply
     * @return
     */
    public int updatePurchaseApplyDeleteFlag(PurchaseApply purchaseApply);

    /**
     * 采购申请单详细查询
     * @param purchaseApplyList
     * @return
     */
    public List<PurchaseApplyList> selectPurchaseApplyListList(PurchaseApplyList purchaseApplyList);

    /**
     * 查询采购申请单对应的所有产品详细
     * @param purchaseApplyId 采购申请单编号
     * @return
     */
    public List<PurchaseApplyList>  selectPurchaseApplyListListById(String purchaseApplyId);

    /**
     * 查询采购申请单对应的指定产品详细
     * @param purchaseApplyId
     * @return
     */
    public PurchaseApplyList  selectPurchaseApplyListById(@Param("purchaseApplyId")String purchaseApplyId, @Param("produceId")String produceId);

    /**
     * 采购申请单详细新增
     * @param purchaseApplyList
     * @return
     */
    public int insertPurchaseApplyList(PurchaseApplyList purchaseApplyList);

    /**
     * 采购申请单详细更新
     * @param purchaseApplyList
     * @return
     */
    public int updatePurchaseApplyList(PurchaseApplyList purchaseApplyList);

    /**
     * 更新采购订单详细的采购状态
     * @param purchaseApplyList
     * @return
     */
    public int updatePurchaseApplyListStatus(PurchaseApplyList purchaseApplyList);

    /**
     * 删除采购申请单详细
     * @param purchaseApplyId  采购申请单编号
     * @param produceId 产品编号
     * @return
     */
    public int deletePurchaseApplyListById(@Param("purchaseApplyId")String purchaseApplyId, @Param("produceId")String produceId);

    /**
     * 获取最大的采购申请单编号
     * @return
     */
    public String selectMaxPurchaseApplyId();
}
